package com.ybwh.springboot2.common.enumhub.enumat;

import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ybwh.springboot2.common.enumhub.CodeTextEnum;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

/**
 * <p>
 *  标注VO字段对应的枚举类
 * </p>
 *
 * @author fanbeibei
 * @version 1.0.0
 * @date 2022/3/14 18:05
 */
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
@JacksonAnnotationsInside
@JsonSerialize(using = EnumAtSerializer.class)
@Constraint(validatedBy = EnumFieldValidator.class)
public @interface EnumField {
    Class<? extends CodeTextEnum> value();

    //--------------------以下是校验用-----------------------------------------------------
    String message() default "";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
